package com.tony.blog.model.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tony.blog.model.entity.BlogEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @Title: BlogMapper
 * @Auther: 皮蛋布丁
 * @Date: 2021/08/15/18:59
 * @Description: 博文
 */
@Mapper
public interface BlogMapper extends BaseMapper<BlogEntity> {
    
    /**
    * @Description: pageCenterBlog 获取首页数据列表信息(向下滚动分页)
    * @Param: [iPage, paramMap]
    * @return: java.util.List<com.tony.blog.model.entity.BlogEntity>
    * @Author: 皮蛋布丁
    * @Date: 2021/8/15 19:02
    */
    List<BlogEntity> pageCenterBlog(IPage<BlogEntity> iPage, @Param("paramMap")Map<String,Object> paramMap);

    /**
    * @Description: selectByPK 根据id获取博文
    * @Param: [id]
    * @return: com.tony.blog.model.entity.BlogEntity
    * @Author: 皮蛋布丁
    * @Date: 2021/8/15 20:25
    */
    BlogEntity selectByPK(@Param("id") Integer id);

    /**
    * @Description: countByForwardBlog 根据博文id获取博文数量
    * @Param: [userId, blogId]
    * @return: java.lang.Integer
    * @Author: 皮蛋布丁
    * @Date: 2021/8/16 20:33
    */
    Integer countByForwardBlog(@Param("userId") Long userId,@Param("blogId") Integer blogId);

    /**
    * @Description: countByUserId 获取关注数
    * @Param: [userId]
    * @return: java.lang.Integer
    * @Author: 皮蛋布丁
    * @Date: 2021/8/19 20:17
    */
    Integer countByUserId(@Param("userId") int userId);

    /**
    * @Description: selectPraiseBlogByUId 获取首页博文列表
    * @Param: [page, params]
    * @return: java.util.List<com.tony.blog.model.entity.BlogEntity>
    * @Author: 皮蛋布丁
    * @Date: 2021/9/10 16:39
    */
    List<BlogEntity> selectPraiseBlogByUId(IPage<BlogEntity> page,
                                           @Param("paramMap") Map<String, Object> params);

    /**
    * @Description: selectCollectBlogByUId 获取首页我收藏的博文列表
    * @Param: [page, paramMap]
    * @return: java.util.List<com.tony.blog.model.entity.BlogEntity>
    * @Author: 皮蛋布丁
    * @Date: 2021/9/16 10:17
    */
    List<BlogEntity> selectCollectBlogByUId(IPage<BlogEntity> page,@Param("paramMap") Map<String,
            Object> paramMap);
    
    /**
    * @Description: selectBlogByUIds 获取收藏用户的所有博文
    * @Param: [userIds]
    * @return: java.util.List<com.tony.blog.model.entity.BlogEntity>
    * @Author: 皮蛋布丁
    * @Date: 2021/9/16 10:58
    */
    List<BlogEntity> selectBlogByUIds(@Param("userIds") String userIds);

    /**
    * @Description: selectAll 获取所有博文
    * @Param: []
    * @return: java.util.List<com.tony.blog.model.entity.BlogEntity>
    * @Author: 皮蛋布丁
    * @Date: 2021/9/28 10:47
    */
    List<BlogEntity> selectAll();

    /**
    * @Description: pageBlogAdmin 获取博文列表(分页、模糊)
    * @Param: [page, params]
    * @return: java.util.List<com.tony.blog.model.entity.BlogEntity>
    * @Author: 皮蛋布丁
    * @Date: 2021/9/29 10:23
    */
    List<BlogEntity> pageBlogAdmin(IPage<BlogEntity> page,
                                   @Param("params") Map<String, Object> params);

    /**
    * @Description: deletes 后台批量删除博文
    * @Param: [ids]
    * @return: java.lang.Integer
    * @Author: 皮蛋布丁
    * @Date: 2021/9/29 11:24
    */
    Integer deletes(@Param("ids") String ids);

    /**
    * @Description: active 根据id批量屏蔽/恢复博文
    * @Param: [idStr]
    * @return: void
    * @Author: 皮蛋布丁
    * @Date: 2021/9/29 11:48
    */
    Integer active(@Param("ids") String ids);

    /**
    * @Description: selectByIds 根据ids获取博文列表
    * @Param: [ids]
    * @return: java.util.List<com.tony.blog.model.entity.BlogEntity>
    * @Author: 皮蛋布丁
    * @Date: 2021/9/29 14:15
    */
    List<BlogEntity> selectByIds(@Param("ids") String ids);
}
